Class ExtAttrDynMapper


public class ExtAttrDynMapper extends DBDynAttrMapper
Maps dynamic data for the extData- prefix to and from the extData Hashtable in RequestRecord. The data in RequestRecord is stored in a Hashtable. It comes in two forms: 1. String key1 String value1 String key2 String value2 This is stored in LDAP as: extData-key1 value1 extData-key2 value2 2. String key Hashtable value where value stores: String key2 String value2 String key3 String value3 This is stored in LDAP as: extData-key;key2 value2 extData-key;key3 value3 These can be mixed, but each top-level key can only be associated with a String value or a Hashtable value.
  • Field Details

  • Constructor Details

    • ExtAttrDynMapper

      public ExtAttrDynMapper()
  • Method Details

    • supportsLDAPAttributeName

      public boolean supportsLDAPAttributeName(String attrName)
      Description copied from class: DBDynAttrMapper
      Returns true if the LDAP attribute can be mapped by this dynamic mapper.
      Overrides:
      supportsLDAPAttributeName in class DBDynAttrMapper
      Parameters:
      attrName - LDAP attribute name to check
      Returns:
      a list of supported attribute names
    • getSupportedLDAPAttributeNames

      public Enumeration<String> getSupportedLDAPAttributeNames()
      Description copied from class: DBAttrMapper
      Retrieves a list of LDAP attributes that are used in the mapper. By having this, the framework can provide search on selective attributes.
      Overrides:
      getSupportedLDAPAttributeNames in class DBDynAttrMapper
      Returns:
      a list of supported attribute names
    • decodeKey

      public String decodeKey(String key)
      Decodes extdata encoded keys. -- followed by a 4 digit hexadecimal string is decoded to the character representing the hex string. The routine is written to be highly efficient. It only allocates the StringBuffer if needed and copies the pieces in large chunks.
      Parameters:
      key - The key to decode
      Returns:
      The decoded key.
    • encodeKey

      public String encodeKey(String key)
      Encoded extdata keys for storage in LDAP. The rules for encoding are trickier than decoding. We want to allow '-' by itself to be stored in the database (for the common case of keys like 'Foo-Bar'. Therefore we are using '--' as the encoding character. The rules are: 1) All characters [^-a-zA-Z0-9] are encoded as --XXXX where XXXX is the hex representation of the digit. 2) [a-zA-Z0-9] are always passed through unencoded 3) [-] is passed through as long as it is preceded and followed by [a-zA-Z0-9] (or if it's at the beginning/end of the string) 4) If [-] is preceded or followed by [^a-zA-Z0-9] then the - as well as all following [^a-zA-Z0-9] characters are encoded as --XXXX. This routine tries to be as efficient as possible with StringBuffer and large copies. However, the encoding unfortunately requires several objects to be allocated.
      Parameters:
      key - The key to encode
      Returns:
      The encoded key
    • isAlphaNum

      protected boolean isAlphaNum(char in)
    • mapObjectToLDAPAttributeSet

      public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, netscape.ldap.LDAPAttributeSet attrs) throws EBaseException
      Description copied from class: DBAttrMapper
      Maps object attribute into LDAP attributes.
      Overrides:
      mapObjectToLDAPAttributeSet in class DBDynAttrMapper
      Parameters:
      parent - parent object where the object comes from
      name - name of db attribute
      obj - object itself
      attrs - LDAP attribute set where the result should be stored
      Throws:
      EBaseException - failed to map object
    • mapLDAPAttributeSetToObject

      public void mapLDAPAttributeSetToObject(netscape.ldap.LDAPAttributeSet attrs, String name, IDBObj parent) throws EBaseException
      Description copied from class: DBAttrMapper
      Maps LDAP attributes into object, and puts the object into 'parent'.
      Overrides:
      mapLDAPAttributeSetToObject in class DBDynAttrMapper
      Parameters:
      attrs - LDAP attribute set
      name - name of db attribute to be processed
      parent - parent object where the object should be added
      Throws:
      EBaseException - failed to map object
    • mapSearchFilter

      public String mapSearchFilter(String name, String op, String value) throws EBaseException
      Description copied from class: DBAttrMapper
      Maps search filters into LDAP search filter.
      Overrides:
      mapSearchFilter in class DBDynAttrMapper
      Parameters:
      name - name of db attribute
      op - filte operation (i.e. "=", ">=")
      value - attribute value
      Throws:
      EBaseException - failed to map filter